package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Service("userService")
public class UserServiceImpl implements UserService {
    @Value("王五")
    private String name;
    @Value("21")
    private int age;
    @Autowired
    private UserDao userDao;


    public UserServiceImpl() { }

    public UserServiceImpl(String name, int age, UserDao userDao) {
        this.name = name;
        this.age = age;
        this.userDao = userDao;
    }

    @Override
    public void save() {
        System.out.println("UserServiceImpl save is running..."+name+"..."+age);
        userDao.save();
    }
}